package com.yzy.fly.boot;

import com.yzy.fly.config.FlyTransaction;
import com.yzy.fly.config.FlyTransactionAttribute;
import com.yzy.fly.kernel.model.FlyBasicModel;
import com.yzy.fly.kernel.service.FlyCrudService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author
 */
@Service
public class FlyTransactionService extends FlyCrudService<Long, FlyTransaction> {

    @Override
    public void saveRoleChildrensBefore(FlyBasicModel child, FlyTransaction parent, Map<String, Object> globalVariables) {
        if (child instanceof FlyTransactionAttribute) {
            FlyTransactionAttribute flyTransactionAttribute = (FlyTransactionAttribute)child;
            flyTransactionAttribute.setTransactionId(parent.getId());
            flyTransactionAttribute.setAppId(parent.getAppId());
            flyTransactionAttribute.setStartupId(parent.getStartupId());
        }
    }


}

